package it.polimi.jita.cp.block.dd;

import it.polimi.jita.cp.block.Input;

public class DynamicDecisionMakerInput extends Input {
	private HostData hostData;
	private NewVirtualMachineData newVm;
	private Integer samplingTime;

	private Integer vCpuNum;

	protected DynamicDecisionMakerInput(HostData hostData,
			NewVirtualMachineData newVm, Integer samplingTime) {
		super();
		this.hostData = hostData;
		this.newVm = newVm;
		this.samplingTime = samplingTime;
	}

	protected HostData getHostData() {
		return hostData;
	}

	protected NewVirtualMachineData getNewVm() {
		return newVm;
	}

	public Integer getSamplingTime() {
		return samplingTime;
	}

	public Integer getLogInstantsNum() {
		return hostData.getVms().iterator().next().getCastedInstants().size();
	}

	public Integer getvCpuNum() {
		if (vCpuNum != null)
			return vCpuNum;
		vCpuNum = 0;
		for (AbstractVirtualMachineData vm : hostData.getVms()) {
			vCpuNum += vm.getvCpuNum();
		}

		vCpuNum += newVm.getvCpuNum();
		return vCpuNum;
	}
}
